import org.kwis.msp.lcdui.*;
import org.kwis.msp.lwc.*;

public class ImageTest extends Jlet
{
	protected void startApp(String args[]){
		Display dis = Display.getDefaultDisplay();
		dis.pushCard(new SampleCard());
        }
	protected void destroyApp(boolean b){
	}
};

class SampleCard extends Card implements ImageObserver
{
	Image img = null;
	Image copy = null;
	int notifyCounter = 0;

	public SampleCard()
	{
		try
		{
			img = Image.createImage("ani.gif");	
			copy = Image.createImage(Image.createImage("copy.gif"));
		}
		catch (Exception e)
		{
		}
	}
	
	public void paint(Graphics g)
	{
		g.drawImage(img,0,0,Graphics.LEFT);
		img.play(this);
		
		g.setClip(0,img.getHeight(),getWidth(),getHeight()-img.getHeight());
	
		Graphics imgGraphics = copy.getGraphics();
		imgGraphics.setColor(0xffffff);
		imgGraphics.fillRect(0,getHeight()-15,copy.getWidth(),15);
		imgGraphics.setColor(0x000000);
		
		imgGraphics.drawString("Notify counter : "+notifyCounter,1,getHeight()-3,Graphics.BOTTOM);

		g.drawImage(copy,0,0,Graphics.LEFT);
	}

	public void notify(Image img, int status)
	{
		notifyCounter++;
		repaint();
	}
};
